#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
	char s[101] = {0};
	char arr[16] = {0};
	fgets(s, 101, stdin);
	int len = strlen(s);
	if (s[len - 1] == '\n')
		s[--len] = '\0';
	int i, j;
	int k = 0;
	int flag = 0;
	for (i = len - 1; i >= 0; i--) {
		if (isalpha(s[i])) {
			arr[k++] = s[i];
			flag = 1;
		}
		if ((s[i] == ' ' && flag == 1) || i == 0) {
			for (j = k - 1; j >= 0; j--) {
				printf("%c", arr[j]);
				arr[j] = 0;
				flag = 0;
			}
			if (i == 0)
				break;
			printf(" ");
			k = 0;
		}
	}


	return 0;
}